package com.gitee.faster.webdav.kernel.model;

import jakarta.xml.bind.annotation.*;
import lombok.Data;
import lombok.experimental.Accessors;
import org.smartboot.http.common.utils.Mimetypes;

import java.util.Collections;
import java.util.List;

/**
 * @author hongda.li
 */
@SuppressWarnings("SpellCheckingInspection")
@Data
@Accessors(chain = true)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
        "content"
})
@XmlRootElement(name = "getcontenttype")
public class GetContentType {

    @XmlMixed
    private List<String> content;

    public static GetContentType byName(String name) {
        GetContentType contentType = new GetContentType();
        contentType.setContent(Collections.singletonList(Mimetypes.getInstance().getMimetype(name)));
        return contentType;
    }
}
